<template>
  <div class="content-wrapper">
    <v-header :title="title"></v-header>
    <div class="wrapper" :style="{height: scrollHeight + 'px'}">
      <div class="content" v-html="contentHTML"></div>
    </div>
  </div>
</template>

<script>
import VHeader from '@/components/v-header/v-header'

import axios from '@/api/axiosApi'
import { isIphoneX } from '@/assets/js/brower'

export default {
  data() {
    return {
      title: '内容详情页',
      contentHTML: '',
      contentText: ''
    }
  },
  components: {
    VHeader
  },
  created() {
    this.scrollHeight = window.innerHeight - (40 + 24)
    if (isIphoneX()) {
      this.scrollHeight = window.innerHeight - (40 + 34)
    }

    this.title = this.$route.params.title
    this._getDetail()
  },
  methods: {
    _getDetail() {
      axios.get(this, `/v1/contentDesc/${this.$route.params.contentId}`, null, (data) => {
        this.contentHTML = data.contentHtml
      })
    }
  }
}
</script>

<style lang="stylus">
@import '~@/assets/css/variable.styl';

.content-wrapper {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: #fff;
  z-index: 102;
  font-size: 14px;
  line-height: 1.4;
  .wrapper {
    padding 10px 15px;
    overflow-y scroll;
    -webkit-overflow-scrolling: touch;
  }
  p {
    margin-bottom: 9px;
  }
  img {
    width: 100%;
  }
}
</style>

